﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PSL.ST
{
    internal class ParameterNode : TreeNode
    {
        public ParameterNode(TreeNode Parent)
            : base(Parent, TreeNodeType.Parameter)
        {

        }

        public string ParameterName
        {
            get;
            set;
        }

        public override TreeNode CloneNode()
        {
            ParameterNode returnNode = new ParameterNode(null);

            returnNode.ParameterName = this.ParameterName;

            return returnNode;
        }

        public override dynamic Execute(PSLEngine Engine)
        {
            if (this.Children.Count == 0)
            {
                throw new Exception("No child in Parameter: " + ParameterName);
            }
            else
            {
                return this.Children[0].Execute(Engine);
            }
        }
    }
}
